package com.lyeducation.social;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.social.security.SocialAuthenticationFilter;
import org.springframework.stereotype.Component;

@Component
public class SsbSocialAuthenticationFilterPostProcessor implements SocialAuthenticationFilterPostProcessor {

    @Autowired
    private AuthenticationSuccessHandler ssbAuthenticationSuccessHandler;
    @Autowired
    private AuthenticationFailureHandler ssbAuthenticationFailureHandler;
    // 后处理器
    @Override
    public void process(SocialAuthenticationFilter socialAuthenticationFilter) {
        socialAuthenticationFilter.setAuthenticationSuccessHandler(ssbAuthenticationSuccessHandler);
        socialAuthenticationFilter.setAuthenticationFailureHandler(ssbAuthenticationFailureHandler);
    }
}